package com.clinic.entity.db;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = Appointment.TABLE)
public class Appointment implements Serializable {

	private static final long serialVersionUID = 8305975685919419634L;

	public static final String TABLE = "appointment";
	
	public static final class Columns {
		public static final String APPOINTMENT_ID = "appointmentId";
		public static final String DATE_AND_TIME = "dateAndTime";
		public static final String APPOINTMENT_INDEX= "appointmentIndex";
		public static final String STATUS = "status";
		public static final String USER_ID = "userId";
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = Columns.APPOINTMENT_ID)
	private long appointmentId;
	
	@Column(name = Columns.APPOINTMENT_INDEX)
	private int appointmentIndex;
	
	@Column(name = Columns.STATUS)
	private String status;
	
	@Column(name = Columns.DATE_AND_TIME)
	private Date dateAndTime;
	
	@ManyToOne(cascade=CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = Columns.USER_ID)
	private Patient patient;

	public long getAppointmentId() {
		return appointmentId;
	}

	public void setAppointmentId(long appointmentId) {
		this.appointmentId = appointmentId;
	}

	public Date getDateAndTime() {
		return dateAndTime;
	}

	public void setDateAndTime(Date dateAndTime) {
		this.dateAndTime = dateAndTime;
	}

	public int getAppointmentIndex() {
		return appointmentIndex;
	}

	public void setAppointmentIndex(int appointmentIndex) {
		this.appointmentIndex = appointmentIndex;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Patient getPatient() {
		return patient;
	}

	public void setPatient(Patient patient) {
		this.patient = patient;
	}
	
}
